In [2]:
import osmnx
import pandas as pd
import geopandas as gpd
import folium
import shapely
In [3]:
PLACE_NAME = "Pune, Maharashtra, India"
graph_drive = osmnx.graph_from_place(PLACE_NAME,
network_type="drive") #network_type="drive"
figure, ax2 = osmnx.plot_graph(graph_drive)
In [4]:
edges_drive = osmnx.graph_to_gdfs(graph_drive,
nodes=False,
edges=True)
In [5]:
edges_sub = edges_drive[['highway',
'length',
'geometry',
'lanes',
'name',
'bridge']]
bridge = edges_sub[(edges_sub['bridge'] == 'yes') | (edges_sub['bridge'] == 'viaduct')]
bridge.to_csv('Pune_Bridges.csv')
bridge
Out[5]:
highway | length | geometry | lanes | name | bridge | |||
---|---|---|---|---|---|---|---|---|
u | v | key | ||||||
245645414 | 245645415 | 0 | residential | 27.500 | LINESTRING (73.81082 18.45942, 73.81108 18.45939) | NaN | Sinhagad Road | yes |
245645415 | 245645414 | 0 | residential | 27.500 | LINESTRING (73.81108 18.45939, 73.81082 18.45942) | NaN | Sinhagad Road | yes |
245645447 | 245645615 | 0 | trunk | 1250.661 | LINESTRING (73.85807 18.46246, 73.85809 18.462... | 2 | Sadguru Shankar Maharaj Uddanpul | yes |
245645724 | 1224905721 | 0 | trunk | 117.146 | LINESTRING (73.85710 18.47709, 73.85705 18.477... | 2 | Satara Road | yes |
245645855 | 248170961 | 0 | primary | 1220.570 | LINESTRING (73.88661 18.48993, 73.88652 18.490... | NaN | Kondhwa Marg | yes |
... | ... | ... | ... | ... | ... | ... | ... | ... |
12109702231 | 1330411956 | 0 | trunk | 238.154 | LINESTRING (73.90105 18.50650, 73.90081 18.506... | 3 | Solapur Road | yes |
12124231127 | 2954430480 | 0 | primary | 703.291 | LINESTRING (73.89033 18.55518, 73.89031 18.555... | NaN | Chhatrapati Shahu Maharaj Flyover | yes |
12154760541 | 12154760540 | 0 | primary | 564.150 | LINESTRING (73.82818 18.48588, 73.82819 18.485... | 3 | Sinhagad Road Flyover | yes |
12203546213 | 2171089142 | 0 | trunk | 232.650 | LINESTRING (73.85510 18.53027, 73.85502 18.530... | 1 | H. K. Firodia Bridge | yes |
12287362347 | 7065593407 | 0 | trunk | 160.377 | LINESTRING (73.89877 18.50671, 73.89912 18.506... | 3 | Solapur Road | yes |
637 rows × 6 columns
In [6]:
pub_trans = osmnx.features_from_place(PLACE_NAME,
{'public_transport': True,
'railway': True})
pub_trans.to_csv('Pune_Pub_Trans.csv')
pub_trans
Out[6]:
bus | highway | name | name:mr | public_transport | geometry | crossing:barrier | railway | addr:city | addr:housenumber | ... | horse | motor_vehicle | website | building:levels | height | min_height | min_level | industrial | landuse | level | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element_type | osmid | |||||||||||||||||||||
node | 245646238 | yes | bus_stop | Sutar Davakhana | सुतार दवाखाना | stop_position | POINT (73.80753 18.50410) | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
245647406 | NaN | NaN | NaN | NaN | NaN | POINT (73.89727 18.52719) | full | level_crossing | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
248156037 | yes | bus_stop | Deccan Corner | डेक्कन कॉर्नर | stop_position | POINT (73.84115 18.51338) | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
343304315 | NaN | NaN | Pune Junction | NaN | station | POINT (73.87441 18.52888) | NaN | station | Pune | Near Jahangir Hospital | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
531393992 | NaN | NaN | NaN | NaN | NaN | POINT (73.85521 18.56592) | NaN | level_crossing | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
way | 1319646961 | NaN | NaN | Purple Line | NaN | NaN | LINESTRING (73.85876 18.52639, 73.85947 18.526... | NaN | subway | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1319646962 | NaN | NaN | Pune Metro Line 1 | पुणे मेट्रो मार्गिका १ | NaN | LINESTRING (73.85734 18.49888, 73.85752 18.49973) | NaN | subway | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
1319646963 | NaN | NaN | Pune Metro Line 1 | पुणे मेट्रो मार्गिका १ | NaN | LINESTRING (73.85722 18.49891, 73.85741 18.49975) | NaN | subway | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
1322447614 | NaN | NaN | NaN | NaN | NaN | LINESTRING (73.85400 18.57090, 73.85418 18.570... | NaN | disused | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
1322447615 | NaN | NaN | NaN | NaN | NaN | LINESTRING (73.85477 18.57111, 73.85492 18.57115) | NaN | disused | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1018 rows × 90 columns
In [7]:
metro = pub_trans[pub_trans['railway'] == 'subway']
metro = metro[metro['bridge'] == 'yes']
In [8]:
hotel = gpd.GeoDataFrame({'id':['Blue_Diamond_Hotel'],
'geometry':[shapely.Point(73.88632931059034,18.538349158201086)]},
crs='EPSG:4326')
swach = gpd.GeoDataFrame({'id':['SWaCH_Pune'],
'geometry':[shapely.Point(73.85579554559784, 18.50359639546184)]},
crs='EPSG:4326')
rannniti = gpd.GeoDataFrame({'id':['RannNiti'],
'geometry':[shapely.Point(73.9000271246573, 18.539212389758735)]},
crs='EPSG:4326')
yutak = gpd.GeoDataFrame({'id':['YUTAK'],
'geometry':[shapely.Point(73.7848050733244, 18.648347408214402)]},
crs='EPSG:4326')
dest = pd.concat([hotel, swach, rannniti, yutak], ignore_index=True)
Locations of road and metro flyovers relative to where we will be on our itinerary from Monday to Wednesday¶
In [10]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
dest.explore(m = flyover, marker_type = 'marker', popup = True)
Out[10]:
Make this Notebook Trusted to load map: File -> Trust Notebook
=====================================================================================================================
In [12]:
atm = pd.read_excel('ATM.xlsx')
atm['geometry'] = atm.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
atm = gpd.GeoDataFrame(atm, columns=['name', 'address', 'geometry'], crs='epsg:4326')
atm = atm.set_geometry('geometry')
bank = pd.read_excel('Banks.xlsx')
bank['geometry'] = bank.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
bank = gpd.GeoDataFrame(bank, columns=['name', 'address', 'geometry'], crs='epsg:4326')
bank = bank.set_geometry('geometry')
blood = pd.read_excel('Blood Bank.xlsx')
blood['geometry'] = blood.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
blood = gpd.GeoDataFrame(blood, columns=['name', 'address', 'geometry'], crs='epsg:4326')
blood = blood.set_geometry('geometry')
garden = pd.read_excel('Garden.xlsx')
garden['geometry'] = garden.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
garden = gpd.GeoDataFrame(garden, columns=['name', 'address', 'geometry'], crs='epsg:4326')
garden = garden.set_geometry('geometry')
college = pd.read_excel('GIS-College Details in Pune.xlsx')
college['geometry'] = college.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
college = gpd.GeoDataFrame(college, columns=['name', 'address', 'geometry'], crs='epsg:4326')
college = college.set_geometry('geometry')
govt = pd.read_excel('Government Offices.xlsx')
govt['geometry'] = govt.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
govt = gpd.GeoDataFrame(govt, columns=['name', 'address', 'geometry'], crs='epsg:4326')
govt = govt.set_geometry('geometry')
lib = pd.read_excel('Library.xlsx')
lib['geometry'] = lib.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
lib = gpd.GeoDataFrame(lib, columns=['name', 'address', 'geometry'], crs='epsg:4326')
lib = lib.set_geometry('geometry')
med_store = pd.read_excel('Medical Stores.xlsx')
med_store['geometry'] = med_store.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
med_store = gpd.GeoDataFrame(med_store, columns=['name', 'address', 'geometry'], crs='epsg:4326')
med_store = med_store.set_geometry('geometry')
parking = pd.read_excel('Parking.xlsx')
parking['geometry'] = parking.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
parking = gpd.GeoDataFrame(parking, columns=['name', 'address', 'geometry'], crs='epsg:4326')
parking = parking.set_geometry('geometry')
pmc_office = pd.read_excel('PMC Offices.xlsx')
pmc_office['geometry'] = pmc_office.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
pmc_office = gpd.GeoDataFrame(pmc_office, columns=['name', 'address', 'geometry'], crs='epsg:4326')
pmc_office = pmc_office.set_geometry('geometry')
sport = pd.read_excel('PMC Sport Complex.xlsx')
sport['geometry'] = sport.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
sport = gpd.GeoDataFrame(sport, columns=['name', 'address', 'geometry'], crs='epsg:4326')
sport = sport.set_geometry('geometry')
ward_office = pd.read_excel('PMC Ward Offices.xlsx')
ward_office['geometry'] = ward_office.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
ward_office = gpd.GeoDataFrame(ward_office, columns=['name', 'address', 'geometry'], crs='epsg:4326')
ward_office = ward_office.set_geometry('geometry')
police = pd.read_excel('Police Stations.xlsx')
police['geometry'] = police.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
police = gpd.GeoDataFrame(police, columns=['name', 'address', 'geometry'], crs='epsg:4326')
police = police.set_geometry('geometry')
post = pd.read_excel('Post Office.xlsx')
post['geometry'] = post.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
post = gpd.GeoDataFrame(post, columns=['name', 'address', 'geometry'], crs='epsg:4326')
post = post.set_geometry('geometry')
resto = pd.read_excel('Restaurants.xlsx')
resto['geometry'] = resto.apply(lambda row: shapely.geometry.Point(row['longitude'], row['latitude']), axis=1)
resto = gpd.GeoDataFrame(resto, columns=['name', 'address', 'geometry'], crs='epsg:4326')
resto = resto.set_geometry('geometry')
C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow() C:\Users\Khalis\anaconda3\Lib\site-packages\openpyxl\packaging\core.py:99: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). now = datetime.datetime.utcnow()
ATMs mapped with road and metro flyovers¶
In [14]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
atm.explore(m = flyover, marker_type = 'marker', popup = True)
Out[14]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Banks mapped with road and metro flyovers¶
In [16]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
bank.explore(m = flyover, marker_type = 'marker', popup = True)
Out[16]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Blood Banks mapped with road and metro flyovers¶
In [18]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
blood.explore(m = flyover, marker_type = 'marker', popup = True)
Out[18]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Gardens mapped with road and metro flyovers¶
In [20]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
garden.explore(m = flyover, marker_type = 'marker', popup = True)
Out[20]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Colleges mapped with road and metro flyovers¶
In [22]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
college.explore(m = flyover, marker_type = 'marker', popup = True)
Out[22]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Libraries mapped with road and metro flyovers¶
In [24]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
lib.explore(m = flyover, marker_type = 'marker', popup = True)
Out[24]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Medical Stores mapped with road and metro flyovers¶
In [26]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
med_store.explore(m = flyover, marker_type = 'marker', popup = True)
Out[26]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Parking Spaces mapped with road and metro flyovers¶
In [28]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
parking.explore(m = flyover, marker_type = 'marker', popup = True)
Out[28]:
Make this Notebook Trusted to load map: File -> Trust Notebook
PMC Offices mapped with road and metro flyovers¶
In [30]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
pmc_office.explore(m = flyover, marker_type = 'marker', popup = True)
Out[30]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Other Govt Offices mapped with road and metro flyovers¶
In [32]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
govt.explore(m = flyover, marker_type = 'marker', popup = True)
Out[32]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Sports Areas mapped with road and metro flyovers¶
In [34]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
sport.explore(m = flyover, marker_type = 'marker', popup = True)
Out[34]:
Make this Notebook Trusted to load map: File -> Trust Notebook
PMC Ward Offices mapped with road and metro flyovers¶
In [36]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
ward_office.explore(m = flyover, marker_type = 'marker', popup = True)
Out[36]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Police Post mapped with road and metro flyovers¶
In [38]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
police.explore(m = flyover, marker_type = 'marker', popup = True)
Out[38]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Postal Offices mapped with road and metro flyovers¶
In [40]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
post.explore(m = flyover, marker_type = 'marker', popup = True)
Out[40]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Restaurants mapped with road and metro flyovers¶
In [42]:
flyover = bridge.explore(color = 'red', popup = True)
metro.explore (m = flyover, color = 'green', popup = True)
resto.explore(m = flyover, marker_type = 'marker', popup = True)
Out[42]:
Make this Notebook Trusted to load map: File -> Trust Notebook